﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CuteWebUI;


namespace SmallProject.Controllers.Common
{
    public class FileController : Controller
    {
        //
        // GET: /File/

        public ActionResult Index()
        {


            using (CuteWebUI.MvcUploader uploader = new CuteWebUI.MvcUploader(System.Web.HttpContext.Current))
            {
                uploader.UploadUrl = Response.ApplyAppPathModifier("~/UploadHandler.ashx");
                //the data of the uploader will render as <input type='hidden' name='myuploader'> 
                uploader.Name = "myuploader";
                uploader.AllowedFileExtensions = "*.jpg,*.gif,*.png,*.bmp,*.zip,*.rar";

                uploader.InsertText = "选择文件上传";
                string sss = uploader.Render();
                //prepair html code for the view
                ViewData["uploaderhtml"] = uploader.Render();
            };
            return PartialView();
        }

        //文件上传
        [HttpPost]
        public ActionResult Upload(HttpFileCollection files) 
        {

            

            foreach (HttpPostedFile item in files)
            {



            }
            return Content("");
        }

        //文件下载
        [HttpGet]
        public ActionResult DownLoad(string documentNo) 
        {


            return File(new byte[100], "");
        }

    }
}
